package user

import (
	"gorm.io/gorm"
	"time"
)

type User struct {
	ID                 uint           `gorm:"primaryKey" json:"id" gorm:"not null;comment:用户id"`
	WechatOpenId       string         `json:"wechat_open_id" gorm:"size:50;comment:小程序open_id"`
	WechatPublicOpenId string         `json:"wechat_public_open_id" gorm:"size:50;comment:公众号open_id"`
	UnionId            string         `json:"union_id" gorm:"size:50;comment:微信唯一id"`
	Name               string         `json:"name" gorm:"size:50;not null;default:'';comment:真实姓名" `
	Mobile             string         `json:"mobile" gorm:"size:11;not null;default:'';comment:手机号" `
	UserName           string         `json:"user_name" gorm:"size:50;not null;default:'';comment:用户名" `
	Pwd                string         `json:"pwd" gorm:"size:50;not null;default:'';comment:密码" `
	UserType           string         `json:"user_type" gorm:"size:10;not null;default:'visit';comment:用户类型；admin=管理员；company=企业；designer=设计师；visit=访客"`
	Note               string         `json:"note" gorm:"size:200;not null;default:'';comment:备注" comment:"备注"`
	Status             int8           `json:"status"  gorm:"size:1;not null;default:1;comment:状态1=启用；2=禁用"`
	Avatar             string         `json:"avatar"  gorm:"size:200;not null;default:'';comment:头像"`
	Sex                int8           `json:"sex"  gorm:"size:1;not null;default:0;comment:性别 0未知 1男 2女"`
	Description        string         `json:"description"  gorm:"size:200;not null;default:'';comment:简介"`
	CreatedAt          time.Time      `gorm:"autoUpdateTime"json:"createAt"`
	UpdatedAt          time.Time      `gorm:"autoUpdateTime"json:"updatedAt"`
	DeletedAt          gorm.DeletedAt `gorm:"index"`
}

// 覆盖生成表
func (User) TableName() string {
	return "xk_base_user"
}
